package com.wnhz.work.yz.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.wnhz.work.yz.R;

public class ConsentDialogActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      //  setContentView(R.layout.activity_consent_dialog);
        initDialog();
    }

    private void initDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        View view = View.inflate(this, R.layout.dialog_consent, null);
        builder.setView(view);
        AlertDialog show = builder.show();
        Window dialogWindow = show.getWindow();
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        dialogWindow.setGravity(Gravity.CENTER_VERTICAL );
        // lp.x = 100; // 新位置X坐标
        //  lp.y = 100; // 新位置Y坐标
//        lp.width = getWindowManager().getDefaultDisplay().getWidth(); // 宽度
//        lp.height = getWindowManager().getDefaultDisplay().getHeight() / 4; // 高度
      //  lp.alpha = 0.7f; // 透明度
        dialogWindow.setAttributes(lp);
    }
}
